//get file object
var file = document.getElementById('myFile').files[0];
if (file) {
// create reader
var reader = new FileReader();
reader.readAsText(file);
reader.onload = function(e) {
// browser completed reading file - display it
alert(e.target.result);
};
}